if __name__ == "__main__":
    n = int(input().strip())
    for i in range(n):
        date = list(map(int, input().strip().split()))
        n, array = date[0], date[1:]
        print(sum(array))